package com.ljq;
import java.util.Scanner;
public class Main {

    public static void main(String[] args) {
	// write your code here
        //新建一个场景
        Scene scene=new Scene();
        Person player = new Person();
        Ui.printWelcome(player);
        Scanner i = new Scanner(System.in);
        while (true){
            String ii=i.nextLine();
            String[] words=ii.split(" ");
            if(words[0].equals("1")){
                player.id = "20190001";
                player.name = "小白";
                player.hp = 120;
                player.CE = 40;
                System.out.println("成功选择人物  "+player.name+"生命值"+player.hp);
                break;
            }else if(words[0].equals("2")){
                player.id = "20190002";
                player.name = "小明";
                player.hp = 120;
                player.CE = 40;
                System.out.println("成功选择人物  "+player.name+"生命值"+player.hp);
                break;
            } else if(words[0].equals("3")){
                player.id = "20190003";
                player.name = "冉冉";
                player.hp = 120;
                player.CE = 40;
                System.out.println("成功选择人物 "+player.name+"生命值"+player.hp);
                break;
            } else {
                System.out.println("$$$$$$$$$$$$$$$$");
                Ui.printErrorCommand();
            }
        }
        scene.initScene();
        //输出欢迎消息

        Ui.displayReachableRooms(scene.getPerson());
        Scanner in=new Scanner(System.in);
        while (true) {
            //用户输入命令
            String command=in.nextLine();
            //分割命令行各个单元
            String[] words=command.split(" ");
            //根据命令，做相应动作
            if (words[0].equals("help")) {
                Ui.printHelp();

            } else if (words[0].equals("go")) {
                scene.getPerson().go(words[1]);
                scene.play();
            } else if (words[0].equals("bye")) {
                System.out.println("感谢您的光临。再见！");
                break;
            } else {
                if(words[0].equals("attack")){
                    System.out.println("###########");
                    scene.play();
                    scene.defence();
                    //scene.win();
                    System.out.println("________________");
                }else {
                    Ui.printErrorCommand();
                }
            }
        }
    }
}
